﻿@model RoadFlow.Model.FlowEntrust
<form method="post">
    @Html.AntiForgeryToken()
    <br />
    <input type="hidden" name="id" value="@Model.Id" />
    <input type="hidden" name="WriteTime" value="@Model.WriteTime"/>
    <table cellpadding="0" cellspacing="1" border="0" width="97%" class="formtable">
        @if (!"1".Equals(ViewData["isOneSelf"].ToString()))
        {
            <tr>
                <th style="width:100px;">委托人：</th>
                <td><input type="text" name="UserId" dept="0" station="0" unit="0" user="1" group="0" id="UserId" class="mymember" validate="empty" value="u_@Model.UserId" /></td>
            </tr>
        }
        <tr>
            <th>被委托人：</th>
            <td>
                <input type="text" name="ToUserId" dept="0" station="0" unit="0" user="1" group="0" id="ToUserId" class="mymember" validate="empty" value="@Model.ToUserId" />
                @if ("1".Equals(ViewData["isOneSelf"].ToString()))
                {
                    <input type="hidden" name="UserId" value="u_@Model.UserId" />
                }
            </td>
        </tr>
        <tr>
            <th>开始时间：</th>
            <td><input type="text" name="StartTime" id="StartTime" class="mycalendar" istime="1" validate="empty" value="@Model.StartTime.ToString("yyyy-MM-dd HH:mm")" /></td>
        </tr>
        <tr>
            <th>结束时间：</th>
            <td><input type="text" name="EndTime" id="EndTime" class="mycalendar" istime="1" validate="empty" value="@((bool)ViewData["isAdd"]?"":Model.EndTime.ToString("yyyy-MM-dd HH:mm"))" /></td>
        </tr>
        <tr>
            <th>委托流程：</th>
            <td><select class="myselect2" id="flowId" name="flowId" style="width:210px;"><option value=""></option>@Html.Raw(ViewData["flowOptions"])</select> *为空表示全部流程</td>
        </tr>
        <tr>
            <th>备注说明：</th>
            <td><textarea class="mytextarea" id="Note" name="Note" cols="1" rows="1" style="width:95%;height:50px;">@Model.Note</textarea></td>
        </tr>

    </table>
    <div class="buttondiv">
        <input type="button" value="确定保存" class="mybutton" onclick="checkform(this);" />
        <input type="button" class="mybutton" value="取消关闭" style="margin-left: 5px;" onclick="new RoadUI.Window().close();" />
    </div>
</form>
<script type="text/javascript">
    var win = new RoadUI.Window();
    $(window).load(function () {

    });
    function checkform(but)
    {
        var f = document.forms[0];
        if (new RoadUI.Validate().validateForm(f))
        {
            var o = RoadUI.Core.serializeForm($(f));
            $(but).prop("disabled", true);
            $.ajax({
                url: "Save@(Html.Raw(ViewData["queryString"]))", data: o, type: "post", success: function (text)
                {
                    if (RoadUI.Core.checkLogin(text, false))
                    {
                        alert(text);
                    }
                    $(but).prop("disabled", false);
                    win.reloadOpener(undefined, undefined, "query('@ViewData["pageSize"]','@ViewData["pageNumber"]')");
                    win.close();
                }
            });
        }
    }
</script>
